﻿using FluentNHibernate.Mapping;
using easyccms.BusinessLayer.Entities;

namespace easyccms.Nhibernate.Mappings
{
    /// <summary>
    /// Mapping of enitity Article to table in database using nhibernate.
    /// </summary>
    public class ArticleMap : ClassMap<Article>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ArticleMap"/> class.
        /// </summary>
        public ArticleMap()
        {
            Table("Articles");
            Id(x => x.ArticleId);
            Map(x => x.Title);
            Map(x => x.Text);
            Map(x => x.DisplayUntil);
            Map(x => x.Created);
            HasOne(x => x.MenuItem).Cascade.None();
            References(x => x.User).Cascade.None();
            Map(x => x.Deleted);
        }
    }
}
